﻿@inject IJSRuntime JS
@inject IHttpService _httpService

@inject ILocalStorageService _localStorage



@inject NavigationManager NavigationManager

<div>
    <CnGalWebSite.Shared.MasaComponent.Shared.Cards.Images.ImageTransformTip Text="@Context" TextChanged="ContextValueChanged" Class="mb-3" />


    <CnGalWebSite.Shared.MasaComponent.Shared.Components.MasaAlert Type="AlertTypes.Info" Class="mb-4" Color="primary" Transparent="false">
        不了解Markdown？可以在这 <a href="http://www.markdown.cn/" target="_blank" rel="noreferrer" class="primary--text fw-bold">查看语法说明</a>
    </CnGalWebSite.Shared.MasaComponent.Shared.Components.MasaAlert>

    <MasaMarkdown Context="@Context" Height="800" MinHeight="800" Mode="MarkdownEditorMode.sv" ContextChanged="ContextValueChanged" @ref="masaMarkdown" />

</div>

@code {
    [Parameter]
    public string Context { get; set; }
    [Parameter]
    public EventCallback<string> ContextChanged { get; set; }

    MasaMarkdown masaMarkdown;

    protected override async Task OnAfterRenderAsync(bool firstRender)
    {

    }

    public async Task ContextValueChanged(string text)
    {
        Context = text;
        await ContextChanged.InvokeAsync(Context);
    }
}
